﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>兑换明细</title>
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <meta name="keywords" content="销冠,TopSales微信" />
    <meta name="description" content="销冠,TopSales微信,TopSales销冠" />
    <base href="http://static.tops001.com/pointstore/" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <script src="../jq-bs-art.js" type="text/javascript"></script>
    <script src="js/jquery-1.8.1.min.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="js/jquery-Date.js" type="text/javascript"></script>
    <script src="js/jquery-my-Extension.js" type="text/javascript"></script>
    <script src="../kk.js" type="text/javascript"></script>
    <style>
    .opacity{
        -webkit-animation: opacity 0.5s linear;
        animation: opacity 0.5s linear;
    }
    @-webkit-keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }
    @keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }
    /* dropload */
    .dropload-up,.dropload-down{
        position: fixed;
        margin: 0 auto;
        width: 100%;
        height: 0;
        z-index: 999;
        bottom: 0px;
        background: #fff;
        overflow: hidden;
        -webkit-transform:translate3d(0,0,0);
        transform:translate3d(0,0,0);
    }
    .dropload-refresh,.dropload-update,.dropload-load{
        position: absolute;
        left: 50%;
        bottom: 0;
        width: 100%;
        height: 50px;
        line-height: 50px;
        text-align: center;
        -webkit-transform:translate(-50%,0);
        transform:translate(-50%,0);
    }

    .dropload-load .loading{
        display: inline-block;
        height: 15px;
        width: 15px;
        border-radius: 100%;
        margin: 6px;
        border: 2px solid #666;
        border-bottom-color: transparent;
        vertical-align: middle;
        -webkit-animation: rotate 0.75s 0 linear infinite;
        animation: rotate 0.75s 0 linear infinite;
    }
    @-webkit-keyframes rotate {
        0% {
            -webkit-transform: rotate(0deg);
        }
        50% {
            -webkit-transform: rotate(180deg);
        }
        100% {
            -webkit-transform: rotate(360deg);
        }
    }
    @keyframes rotate {
        0% {
            transform: rotate(0deg);
        }
        50% {
            transform: rotate(180deg);
        }
        100% {
            transform: rotate(360deg);
        }
    }
    </style>
</head>


<body>
    <div class="lay100">

        <div class="credit_head">
            <span class="credit_price" id="PointBalance">0</span>
        </div>
        
        <div style="position:relative">
            <div class="credit_middle">
                <div class="title01"><a href="credit_rule.html">积分规则</a></div>
                <div class="title02"><a href="goods_detail.html">兑换记录</a></div>
            </div>
            <div class="credit_title" style="width:70px;">积分明细</div>
            <div class="credit_detail">
                <ul class="credit_nav">
                </ul>
            </div>
        </div>

        <div class="no_more" style='text-align:center;padding-top:10px;padding-bottom:10px;color:#999999;display:none'>没有更多了！</div>
    </div>
    <script type="text/javascript">
        var apiUrl = "http://"+window.location.host+"/";
        $(function () {

            kk.api.get(apiUrl+"/PointDetail/GetListByUserKid", {pageIndex:1,pageSize:10} , function (data) {
                if (data.Items == null || data.Count <= 0) {
                    $(".credit_nav").append($("<div style='text-align:center;padding-top:35px;color:#999999;'>还没有积分明细记录哦！</div>"));
                    return;
                }
                $.each(data.Items, function (i, obj) {
                    var str = " <li>"
                            + " <div class='credit_part'>"
                            + " <div class='btn_left'><div class='txt_head'>" + obj.F_PointAction + "</div><div class='txt_data'>" + $.Timedefined(obj.F_AddTime, "%Y-%m-%d %H:%M") + "</div></div>"
                            + f_IsStatus(obj.F_Point) + "</div>"
                            + " </li>";
                    $(".credit_nav").append(str);
                });
            });

            $(".title02 a").attr("href", apiUrl + "change_histroy.html");
            $(".title01 a").attr("href", apiUrl + "credit_rule.html");

            kk.api.get(apiUrl+"/Point/Get", function (data) {
                if (data == null)
                {
                    return $("#PointBalance").text("0");
                }
                $("#PointBalance").text(data.F_PointBalance);
            });
        });

        function f_IsStatus(point) {
            if (point>=0) {
                return " <div class='btn_right'><a class=\"btn_ingoal\">+" + point + "</a></div>"
            } else {
                return " <div class='btn_right'><a class=\"btn_outgoal\">" + point + "</a></div>"
            }
        }
    </script>

    <script>
        var page = 2;
        var flag = true;
        function getData() {
           kk.api.get(apiUrl+"/PointDetail/GetListByUserKid", {pageIndex:page++,pageSize:10} , function (data) {
                var str = '';
                $.each(data.Items, function (i, obj) {
                        str += " <li class='opacity'>"
                            + " <div class='credit_part'>"
                            + " <div class='btn_left'><div class='txt_head'>" + obj.F_PointAction + "</div><div class='txt_data'>" + $.Timedefined(obj.F_AddTime, "%Y-%m-%d %H:%M") + "</div></div>"
                            + f_IsStatus(obj.F_Point) + "</div>"
                            + " </li>";
                    
                });
                flag = true;
                $(".credit_nav").append(str);
                $('body').animate({ top: "0px" });
                if (data.Items.length < 5) {
                    $(".no_more").show();
                }
                //me.resetload();

            });
        }

        window.onscroll = function() {

            if(document.body.scrollHeight - $(window).height() - $(window).scrollTop() < 50 && flag) {
                flag = false;
                getData()
            }
        }
        
    
    </script>
</body>
</html>
